package cn.wowjoy.pda.android_pharmacy.ui.activity.door;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;

import cn.wowjoy.pda.android_pharmacy.R;
import cn.wowjoy.pda.android_pharmacy.common.core.BaseActivity;
import cn.wowjoy.pda.android_pharmacy.common.utils.PreferenceManager;
import cn.wowjoy.pda.android_pharmacy.databinding.ActivityDoorTaskBinding;
import cn.wowjoy.pda.android_pharmacy.mvvm.presenter.DoorTaskPresenter;
import cn.wowjoy.pda.android_pharmacy.mvvm.vm.DoorTaskViewModel;
import cn.wowjoy.pda.android_pharmacy.ui.activity.LoginActivity;
import cn.wowjoy.pda.android_pharmacy.ui.activity.door.put.DoorPutIndexActivity;
import cn.wowjoy.pda.android_pharmacy.ui.activity.door.take.DoorTakeIndexActivity;

public class DoorTaskActivity extends BaseActivity<ActivityDoorTaskBinding, DoorTaskViewModel, DoorTaskPresenter> implements View.OnClickListener {


    @Override
    protected void init(Bundle savedInstanceState) {

        binding.taskTitle.titleTextTv.setText("门诊药房");
        binding.taskTitle.titleBackTv.setText("");
        binding.taskTitle.titleBackLl.setVisibility(View.VISIBLE);
        binding.taskTitle.titleBackLl.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
        binding.btExit.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent=new Intent(DoorTaskActivity.this, LoginActivity.class);
                intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                startActivity(intent);
                finish();
            }
        });
//        binding.llDoorTaskEmployee.setOnClickListener(this);
        binding.rlDoorTaskTake.setOnClickListener(this);
        binding.rlDoorTaskPut.setOnClickListener(this);
        //TODO:个人信息的更新
//        Log.e("PXY", "setPersonal: "+ PreferenceManager.getInstance().getLUserName() +"  getLUserNum:"+   PreferenceManager.getInstance().getLUserNum());
        if(!PreferenceManager.getInstance().getLUserName().equals("") && !PreferenceManager.getInstance().getLUserNum().equals("")){
            binding.tvTaskEmployeeName.setText(PreferenceManager.getInstance().getLUserName());
            binding.tvTaskEmployeeId.setText(PreferenceManager.getInstance().getLUserNum());
        }
    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_door_task;
    }

    @Override
    protected Class<DoorTaskPresenter> getPresenterClass() {
        return DoorTaskPresenter.class;
    }

    @Override
    protected Class<DoorTaskViewModel> getViewModelClass() {
        return DoorTaskViewModel.class;
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.rl_doorTask_take:
                //跳转 门诊取药
                startActivity(new Intent(DoorTaskActivity.this, DoorTakeIndexActivity.class));
                break;
            case R.id.rl_doorTask_put:
                //跳转 门诊上架
                startActivity(new Intent(DoorTaskActivity.this, DoorPutIndexActivity.class));
                break;
//            case R.id.ll_doorTask_employee:
//                //跳转 个人设置
//                startActivity(new Intent(DoorTaskActivity.this, SettingActivity.class));
//                break;
        }
    }
}
